﻿#include "RichTextParser.h"

NS_CC_BEGIN
namespace ui {

	RichTextParser::RichTextParser()
		:mBold(false),
		mItalic(false),
		mStrike(false),
		mUnder(false),
		mImage(false),
		mHeader1(false),
		mHeader2(false),
		mHeader3(false),
		mColour(false),
		mUrl(false),
		mLinkPoiner("link"),
		mHeader1Font("Default"),
		mHeader2Font("Default"),
		mHeader3Font("Default"),
		mDefaultFont("Default"),
		mBoldFont("Default"),
		mItalicFont("Default"),
		mBoldItalicFont("Default"),
		mBreakHeight(0)
	{
	}

	
	void RichTextParser::updateRichText(RichText* richtext, const std::string& str)
	{
		mRichText = richtext;
		SAXParser parser;
		parser.setDelegator(this);
		parser.init("UTF-8");
		parser.parse(str.c_str(), str.length());
	}

	void RichTextParser::startElement(void *ctx, const char *name, const char **atts)
	{
		
	}

	void RichTextParser::endElement(void *ctx, const char *name)
	{

	}

	void RichTextParser::textHandler(void *ctx, const char *s, int len)
	{

	}

}

NS_CC_END